<include file="Public/min-header"/>
<link href="__PUBLIC__/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />

<script src="__PUBLIC__/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>

<script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<div class="wrapper">
  <include file="Public/breadcrumb"/>
    <section class="content">
        <!-- Main content -->
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
           		<a href="javascript:;" class="btn btn-default" data-url="http://www.vyxjj.com?" onclick="get_help(this)"><i class="fa fa-question-circle"></i> 帮助</a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i> 前台导航</h3>
                </div>
                <div class="panel-body">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_tongyong" data-toggle="tab">前台导航</a></li>
                    </ul>
                    <!--表单数据-->
                    <form method="post" id="addEditNavForm"  onsubmit="return checkName();">                    
                        <!--通用信息-->
                    <div class="tab-content">                 	  
                        <div class="tab-pane active" id="tab_tongyong">
                           
                            <table class="table table-bordered">
                                <tbody>
<!--                                 <tr>
                                    <td>系统内容:</td>
                                    <td>
                                         <select id="system_nav" name="system_nav" class="form-control" style="width:250px;">
                                                <option value="">自定义导航</option>
                                                <foreach name="system_nav"  key='k' item="v" >
                                                    <option value="{$k}"<if condition="$k eq $navigation[url]"> selected </if> >{$v}</option>
                                                </foreach>                                                
                                         </select>
                                    </td>
                                </tr>   -->                              
                                <tr>
                                    <td>导航名称:</td>
                                    <td>
                                        <input type="text" value="{$navigation.name}" name="name" class="form-control" style="width:250px;"/>
                                        <span id="err_name" style="color:#F00; display:none;">导航名称不能为空!!</span>                                        
                                    </td>

                                </tr>
                                <tr>
                                    <td>类型:</td>
                                    <td>
                                        <input type="radio" id="defaut" class="type" name="type" value="0" <if condition='$navigation[type] eq 0'>checked</if>>普通
                                        <input type="radio" id="miniProgram" class="type" name="type" value="1" <if condition='$navigation[type] eq 1'>checked</if>>小程序
										<input type="radio" id="webview" class="type" name="type" value="2" <if condition='$navigation[type] eq 2'>checked</if>>
										网页链接
                                    </td>
                                </tr>

                                <tr style="display: none" id="appid" >
                                    <td> appid:</td>
                                    <td >
                                        <input type="text" value="{$navigation.appid}" id="id" name="appid" class="form-control" style="width:250px;"/>
                                    </td>
                                </tr>
                                
                                <?php $url = $navigation['url']; ?>
                                
								<tr id="link" <if condition="$navigation[type] eq 0"> <else />style="display: none"</if>>
                                    <td>链接:</td>
                                    <td>
                                
                                        
										<select id="system_nav" name="url" class="form-control" style="width:250px;">
                                                <volist name="system_nav" id="v">
                                                
                                                <option value="{$key}"<if condition="$key eq $url">selected</if> >{$v}</option>
                                                </volist>
										</select>
                                        <span id="err_url" style="color:#F00; display:none;"></span>
                                    </td>
                                </tr>
                                <tr id="link1"  <if condition="$navigation[type] eq 1"> <else />style="display: none"</if>>
                                    <td> 链接:</td>
                                    <td >
                                        <input type="text" placeholder="例：/pages/index/index" <if condition="$navigation[type] eq 1"> value="{$navigation.url}" <else /> value=""</if>    name="url1" class="form-control" style="width:250px;"/>
                                    </td>
                                </tr>
                                <tr id="link2"  <if condition="$navigation[type] eq 2"><else />style="display: none"</if> >
                                    <td> 链接:</td>
                                    <td >
                                        <input type="text" placeholder="例：http://www.tianxin100.com" <if condition="$navigation[type] eq 2"> value="{$navigation.url}" <else /> value=""</if>    name="url2" class="form-control" style="width:250px;"/>*需要先<a href="https://mp.weixin.qq.com/">设置业务域名</a>
                                    </td>
                                </tr>
								<tr>
                                    <td>排序:</td>
                                    <td>
                                        <input type="text" value="{$navigation.sort}" name="sort" class="form-control" style="width:200px;" placeholder="50"/>                               
                                    *数字越大排序靠后
									</td>
									
                                </tr>   
                                <tr>
                                    <td>内容:</td>
                                    <td>
                                        <input type="text" value="{$navigation.content}" name="content" class="form-control" style="width:300px;" placeholder="比如：弹出电话的手机号码或者为空"/>                               
                                    
									</td>
									
                                </tr>

								
                                <tr>

                                    <td>图标</td>

                                    <td>

                      					<div class="col-sm-3">



                      						<input type="text" class="form-control" style="width:350px;margin-left:-15px;" name="ad_code" id="ad_code" value="{$navigation.ad_code}" >*建议大小64px*64px   png格式

                      					</div>

                      					<div class="col-sm-3">

                                        	<input type="button" class="btn btn-default" onClick="GetUploadify2(1,'ad_code','ad','')"  value="上传图片"/>

                                        </div>

                                    </td>
								
								</tr>
								
                                </tbody>                                
                                </table>
                        </div>                           
                    </div>              
                    <div class="pull-right">
                        <input type="hidden" name="id" value="{$navigation.id}">
                        <button class="btn btn-primary" title="" data-toggle="tooltip" type="submit" data-original-title="保存">保存</button>
                    </div>
			    </form><!--表单数据-->
                </div>
            </div>
        </div>    <!-- /.content -->
    </section>
</div>
<script>
// 判断输入框是否为空
function checkName(){
	var name = $("#addEditNavForm").find("input[name='name']").val();
    if($.trim(name) == '')
	{
		$("#err_name").show();
		return false;
	}
	return true;
}

$("#miniProgram").click(function(){
    document.getElementById('appid').style.display = "";
    document.getElementById('link').style.display = "none";
    document.getElementById('link1').style.display = "";
	document.getElementById('link2').style.display = "none";
});
$("#defaut").click(function(){
    document.getElementById('appid').style.display = "none";
    document.getElementById('link').style.display = "";
    document.getElementById('link1').style.display = "none";
	document.getElementById('link2').style.display = "none";
});

$("#webview").click(function(){
    document.getElementById('appid').style.display = "none";
    document.getElementById('link').style.display = "none";
    document.getElementById('link1').style.display = "none";
	document.getElementById('link2').style.display = "";
});

</script>

</body>
</html>